📦 Split heavy deps into optional extras and slim the wheel#11
Merged
Conversation
The core devol package only uses numpy, pydantic, and pydantic-yaml, but the shipped dependency list forced every user to install torch, torchvision, gymnasium, and matplotlib — a ~2 GB footprint for a library whose runtime doesn't touch any of them. - Required deps reduced to numpy, pydantic, pydantic-yaml - Drop unused pydantic-settings (leftover from an abandoned branch) - Move torch, torchvision, gymnasium[classic-control], matplotlib into the examples extra (where cartpole/mnist/live-two-peaks actually use them) - Add twine to the dev extra so the build CI job works from a sync - Add an `all` meta-extra that pulls dev + examples + benchmark - Narrow the wheel target to src/devol so examples/ and benchmark/ ship only in the repo, not in the pip install - Add pytest pythonpath config — narrowing the wheel removed the accidental side-effect that let `tests.ci.n_peaks` resolve via editable install, so configure it explicitly - Update README with an Installation section covering the extras - Update CHANGELOG with the dependency changes, the wheel narrowing, and the earlier CI/typing work from PR #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Ships the correct minimal dependency set for
pip install devol. Before this PR, installing the library pulled in torch, torchvision, gymnasium, and matplotlib — hundreds of MB — even though the runtime code insrc/devol/never imports any of them. After this PR the base install is just numpy, pydantic, and pydantic-yaml; the heavy stack moves under theexamplesextra where the cartpole/MNIST/two-peaks demos actually use it.Details
Required dependencies reduced to 3 packages
numpy>=1.26,pydantic>=2.0,pydantic-yaml>=1.6pydantic-settings(leftover import from an abandoned cleanup branch, never referenced in code)Extras restructured
examples—matplotlib,gymnasium[classic-control],torch,torchvisionbenchmark—matplotlib,rich,tqdmdev—ruff,mypy,pytest,twine(addedtwineso the build CI job can validate metadata without an ad-hoc install)all— meta-extra that resolves todevol[dev,examples,benchmark]Wheel narrowed to
src/devol/onlyexamples/was previously shipped inside the wheel even though it's demo code; now it stays in the repo but out of the packagedevol-0.1.0-py3-none-any.whlcontains 9 files underdevol/+ metadata — noexamples, nobenchmark, no testsPytest pythonpath config
tests/test_ci_n_peaks.pyimportsfrom tests.ci.n_peaks. Withexamples/previously shipped as a top-level wheel package, the editable install accidentally exposed the repo root onsys.path, which is where pytest found thetestsnamespace. After narrowing the wheel, that side effect is gone, so pytest gets an explicitpythonpath = ["."]andtestpaths = ["tests"]config.README and CHANGELOG
Verification
Minimal install (no extras) runs the algorithm end-to-end:
All CI gates green locally:
uv run ruff check✓uv run ruff format --check✓uv run mypy src/devol✓uv run pytest✓ (15 passed)uv build+twine check dist/*✓